package com.practice.weather.controller;

import com.practice.weather.domain.WeatherRequestForm;
import com.practice.weather.service.WeatherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class WeatherController {
    @Autowired
    private WeatherService weatherService;

    //AQI预报5天 https://aliv8.data.moji.com/whapi/json/aliweather/aqiforecast5days
    @PostMapping("https://aliv8.data.moji.com/whapi/json/aliweather/aqiforecast5days")
    public String getAqiForecast5Days(@RequestHeader String Authorization, @RequestBody WeatherRequestForm weatherRequestForm) {
        // 验证参数
        if (weatherRequestForm.getLat() == null || weatherRequestForm.getLon() == null || weatherRequestForm.getToken() == null) {
            log.error("参数不能为空");
        }

        // 调用服务处理业务逻辑
//        String result = weatherService.getAqiForecast5Days(request);

        return "AQI预报5天";
    }

    //天气实况

    //天气预报15天

    //天气预报24 小时

    //天气预警

    //生活指数

    //短时预报

    //空气质量指数

    //限行数据

}
